import axios from 'axios';  //引入的axios

//实始化
const $http = axios.create({
  baseURL: 'http://localhost:5000/api/',
  timeout: 8000  //超时时间

})


//请求拦截
$http.interceptors.request.use(config => {
  const token = localStorage.getItem('token');
  if (token) {
    config.headers.Authorization = 'Bearer ' + token;
  }
  return config;
})

//导出
export default $http